import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:ichinesereader/utils/helper.dart';
import 'package:ichinesereader/constants.dart';

class FloatingActionButtons extends StatelessWidget {
  FloatingActionButtons({
    Key? key,
    required this.isStudent,
  }) : super(key: key);

  final bool isStudent;

  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.end,
      children: <Widget>[
        SizedBox(
          width: 45.0,
          height: 45.0,
          child: FloatingActionButton(
            heroTag: Text('Home000000'.tr),
            tooltip: 'Home Screen'.tr,
            onPressed: () {
              isStudent
                  ? Navigator.pushNamed(context, '/student/home')
                  : Navigator.pushNamed(context, '/individual/home');
            },
            child: Icon(
              Icons.home,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 5,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(height: 9.0),
        SizedBox(
          width: 45.0,
          height: 45.0,
          child: FloatingActionButton(
            heroTag: Text('Library000000'.tr),
            tooltip: 'Library'.tr,
            onPressed: () {
              isStudent
                  ? Navigator.pushNamed(context, '/student/library')
                  : Navigator.pushNamed(context, '/individual/library');
            },
            child: Icon(
              Icons.local_library,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 5,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(height: 9.0),
        SizedBox(
          width: 45.0,
          height: 45.0,
          child: FloatingActionButton(
            heroTag: Text('LeveledReadings000000'.tr),
            tooltip: 'Leveled Readings'.tr,
            onPressed: () {
              isStudent
                  ? Navigator.pushNamed(context, '/student/leveledreadings')
                  : Navigator.pushNamed(context, '/individual/leveledreadings');
            },
            child: Icon(
              Icons.trending_up,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 5,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(height: 9.0),
        SizedBox(
          width: 45.0,
          height: 45.0,
          child: FloatingActionButton(
            heroTag: Text('MyFavorites000000'.tr),
            tooltip: 'My Favorites'.tr,
            onPressed: () {
              isStudent
                  ? Navigator.pushNamed(context, '/student/myfavorites')
                  : Navigator.pushNamed(context, '/individual/myfavorites');
            },
            child: Icon(
              Icons.favorite_border_rounded,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 5,
            splashColor: Colors.grey,
          ),
        ),
        SizedBox(height: 9.0),
        SizedBox(
          width: 45.0,
          height: 45.0,
          child: FloatingActionButton(
            heroTag: Text('Gameandrewards0000'.tr),
            tooltip: 'Game and Rewards'.tr,
            onPressed: () {
              if (GetPlatform.isWeb || GetPlatform.isMacOS) {
                launchInWebViewWithJavaScript('${Constants.BaseURL}game/');
              } else {
                Navigator.pushNamed(context, '/student/reward');
              }
            },
            child: Icon(
              Icons.videogame_asset,
              color: Get.isDarkMode
                  ? Get.theme.primaryColorLight
                  : Get.theme.primaryColorLight,
              size: 24,
            ),
            elevation: 5,
            splashColor: Colors.grey,
          ),
        ),
      ],
    );
  }
}
